package com.atguigu.yygh.hosp.controller;

import com.atguigu.yygh.hosp.result.R;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

//@CrossOrigin //跨域问题
@RestController
@RequestMapping("/admin/hosp")
public class LoginController {
    //{"code":20000,"data":{"token":"admin-token"}}
    @PostMapping("/user/login")
    public R login(){
        return R.ok().data("token","admin-token");
    }
/*
{
    "code": 20000,
    "data": {
        "roles": [
            "admin"
        ],
        "introduction": "I am a super administrator",
        "avatar": "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
        "name": "Super Admin"
    }
}
*/
    @GetMapping("/user/info")
    public R info(){
        return R.ok().data("roles", Arrays.asList("admin"))
                     .data("introduction","I am a super administrator")
                     .data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif")
                     .data("name","尚医通管理员");
    }
}
